package com.hhh.springai_test.config;

import jakarta.annotation.Resource;
import org.springframework.ai.zhipuai.ZhiPuAiChatOptions;
import org.springframework.ai.zhipuai.api.ZhiPuAiApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ZhiPuAiApiConfig {

    @Resource
    private ChatConfig chatConfig;

    @Bean
    public ZhiPuAiApi zhiPuAiApi() {
        return new ZhiPuAiApi(chatConfig.getApiKey());
    }

    @Bean
    public ZhiPuAiChatOptions zhiPuAiChatOptions() {
        return ZhiPuAiChatOptions.builder()
                .withModel("GLM-4-Flash")
                .withTemperature(0.95F)
                .build();
    }
}
